<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <!--{include file='comm/header.tpl'}-->
    <title>文章评论列表</title>
</head>
<body>
<div style="width:100%">
    <!--{include file='comm/menu.tpl'}-->

    <table id="flex" style="display:none"></table>

    <!--{include file='comm/footer.tpl'}-->
</div>

<script>
    $("#flex").flexigrid({
        url:"/invokingAjax-backend/content/article.ajax?operFlg=8",
        dataType: "json",
        colModel : [
            {display: "操作", width : 50, align: 'center'},
            {display: "文章标题", width : 250 , align: 'left'},
            {display: "评论内容", width : 300 , align: 'left'},
            {display: "评论时间", width : 150 , align: 'left'},
            {display: "网站用户名", width : 150 , align: 'left'},
            {display: "回复时间", width : 150 , align: 'center'},
            {display: "回复人", width : 80 , align: 'left'},
            {display: "处理状态", width : 80 , align: 'center'}
        ],
        buttons : [
            {name: "删除", bclass: "delete", onpress : "articleComment.delcheck"}
        ],
        sortname: "createTime",
        sortorder: "desc",
        usepager: true,
        rp: 10,
        useRp: true,
        showTableToggleBtn: true
    });

    var articleComment = {

        //记录删除数据数组
        delArr:new Array(),

        //回复
        reply: function(uuid){
            E.open ("/quanliadmin/app/content/article.pscript?operFlg=8&id=" + uuid);
        },

        //删除确认
        delcheck: function(){
            //获取选中的行的行数
            var selected_count = $('.trSelected',flex).length;
            if (selected_count==0) {
                E.alert('请选择要删除的评论');
                return;
            }else{
                var tempArr = new Array();
                for(var i=0; i<selected_count; i++){
                    var uuidStr = $('.trSelected',flex).eq(i).attr('id');
                    var uuid = uuidStr.substr(3);
                    tempArr.push(uuid);
                }
                this.delArr = tempArr;

                //弹出确认层
                E.confirm('确认删除这 ' + $('.trSelected',flex).length + ' 个评论吗?', "articleComment.del");
            }

        },

        del:function(){
            $.ajax({
                type: "POST",
                url: "/invokingAjax-backend/content/article.ajax?operFlg=10",
                dataType: "JSON",
                data:{delArr: articleComment.delArr},
                success: function(result_obj){
                    if (result_obj.code == 200) {
                        E.alert(result_obj.message, 2, "articleComment.load");
                    }
                    else {
                        E.alert(result_obj.message);
                    }
                }
            });
        },

        load: function() {
            $("#flex").flexReload();
        }

    };
</script>
</body>
</html>